
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>后台</title>

    <link href="__PUBLIC__/images/favicon.ico" rel="shortcut icon" />

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-theme.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/dashboard.css" />
    <link rel="stylesheet" href="__PUBLIC__/js/bootstrapvalidator/css/bootstrapValidator.min.css" />

</head>

<body>

<include file="Common/topNav" />

<div class="container-fluid">
    <div class="row">
        <include file="Common/leftMenu" />
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <!--标题头-->
            <div class="cont-title clearfix">
                <div class="title">税收预警参数设置</div>
                <div class="btn-group">
                </div>
            </div>
            <!--表格-->
            <form class="jc-search form-horizontal" id="setForm" style="border-bottom:0;">
                <div class="form-group">
                    <label class="control-label col-sm-2">营业额低于：</label>
                    <div class="col-sm-3">
                        <div class="input-group">
                            <input type="text" class="form-control" name="ss_min_turnover" value="{$setting.ss_min_turnover}" placeholder="请输入最低营业额">
                            <div class="input-group-addon">万元</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">纳税额低于：</label>
                    <div class="col-sm-3">
                        <div class="input-group">
                            <input type="text" class="form-control" name="ss_min_ratal" value="{$setting.ss_min_ratal}" placeholder="请输入最低纳税额">
                            <div class="input-group-addon">万元</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">纳税额占比低于：</label>
                    <div class="col-sm-3">
                        <div class="input-group">
                            <input type="text" class="form-control" name="ss_min_ratal_per" value="{$setting.ss_min_ratal_per}" placeholder="请输入纳税额与营业额比例">
                            <div class="input-group-addon">%</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">同比纳税比例低于：</label>
                    <div class="col-sm-3">
                        <div class="input-group">
                            <input type="text" class="form-control" name="ss_min_tongbi" value="{$setting.ss_min_tongbi}" placeholder="请输入同比纳税比例">
                            <div class="input-group-addon">%</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">环比纳税比例低于：</label>
                    <div class="col-sm-3">
                        <div class="input-group">
                            <input type="text" class="form-control" name="ss_min_huanbi" value="{$setting.ss_min_huanbi}" placeholder="请输入环比纳税比例">
                            <div class="input-group-addon">%</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2"></label>
                    <div class="col-sm-3">
                        <div class="input-group">
                            <button type="button" id="save" class="btn btn-primary">保存</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<include file="Common/modalHtmls" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
<script type="text/javascript">

    $(function () {
        $("#save").bind("click",doSave);
    });
    
    function doSave() {
        if(!validateForm()){
            return false;
        }
        $.ajax({
            url: "{:U('Admin/SystemSettings/doSetting')}",
            type: "post",
            dataType: "json",
            data: $("#setForm").serialize(),
            success: function (data) {
                if(data.status){
                    common.alert("提示",data.msg,function(){
                        common.reload();
                    });
                }else{
                    commitFlag = false;
                    common.alert("提示",data.msg);
                }
            }
        });
    }
    function validateForm(){
        $('#setForm').bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                //invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                ss_min_tongbi: {
                    validators: {
                        notEmpty: {
                            message: '同比纳税比例不能为空'
                        },
                        regexp: {
                            regexp: /((^[1-9]+[0-9]*)|^0)(\.\d{0,2})?$/,
                            message: '同比纳税比例必须为数字'
                        }
                    }
                },
                ss_min_huanbi: {
                    validators: {
                        notEmpty: {
                            message: '环比纳税比例不能为空'
                        },
                        regexp: {
                            regexp: /((^[1-9]+[0-9]*)|^0)(\.\d{0,2})?$/,
                            message: '环比纳税比例必须为数字'
                        }
                    }
                },
                ss_min_turnover: {
                    validators: {
                        notEmpty: {
                            message: '营业额不能为空'
                        },
                        regexp: {
                            regexp: /((^[1-9]+[0-9]*)|^0)(\.\d{0,2})?$/,
                            message: '营业额必须为数字'
                        }
                    }
                },
                ss_min_ratal: {
                    validators: {
                        notEmpty: {
                            message: '纳税额不能为空'
                        },
                        regexp: {
                            regexp: /((^[1-9]+[0-9]*)|^0)(\.\d{0,2})?$/,
                            message: '纳税额必须为数字'
                        }
                    }
                },
                ss_min_ratal_per: {
                    validators: {
                        notEmpty: {
                            message: '纳税额与营业额比例不能为空'
                        },
                        regexp: {
                            regexp: /((^[1-9]+[0-9]*)|^0)(\.\d{0,2})?$/,
                            message: '纳税额与营业额比例必须为数字'
                        }
                    }
                }
            }
        });
        var data = $('#setForm').data('bootstrapValidator');
        if (data) {
            data.validate();
            if (!data.isValid()) {
                return false;
            }
        }
        return true;
    }
</script>
</body>
</html>
